package com.lanou.musicproject.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import com.lanou.musicproject.fragment.AlbumFragment;
import com.lanou.musicproject.fragment.SeekSongFragment;
import com.lanou.musicproject.fragment.SingerFragment;
import com.lanou.musicproject.fragment.SongFragment;

import java.util.ArrayList;



/**
 * Created by dllo on 15/10/22.
 */
public class SeekContentAdapter extends FragmentPagerAdapter {
    private String [] titles ={"歌曲","专辑","歌手"};
    private ArrayList<Fragment>datas;

    public SeekContentAdapter(FragmentManager fm) {
         super(fm);
        init();

    }

    private void init() {
       datas = new ArrayList<Fragment>() ;
        datas.add(new SongFragment());
        datas.add(new AlbumFragment());
        datas.add(new SingerFragment());

    }

    @Override
    public Fragment getItem(int position) {
        return datas.get(position);
    }

    @Override
    public int getCount() {
        return titles.length;
    }

    public CharSequence getPageTitle(int position) {
        return titles[position];
    }
}
